import { http } from '@/utils/http'
import { lessonMainInfo, queryInfo } from './model'

/** 查询课程-主-课程信息列表(学生端) */

export const selectLessonList = (params: {
  pageNum: number
  pageSize: number
  content: string
}) => {
  return http.get<lessonMainInfo>('/edu/lessonMain/selectLessonList', params)
}

/** 获取课程-主-课程信息详细信息 */
export const getLessonInfo = (data: queryInfo) => {
  return http({
    url: '/edu/lessonMain/info',
    method: 'POST',
    data,
  })
}

/** 查询课程信息列表 */

export const getLessonListApi = (params: { pageNum: number; pageSize: number; status: any }) => {
  return http.get<lessonMainInfo>('/edu/lessonMain/list', params)
}
/** 发布课程 */
export const addPublishData = (data: queryInfo) => {
  return http({
    url: '/edu/lessonMain/publish',
    method: 'POST',
    data,
  })
}

/** 【1.3】根据课程id查询出班级学生列表 */

export const getStudentList = (params: { lessonId: number | string }) => {
  return http.get<lessonMainInfo>('/edu/teacher/lesson/getStudentList', params)
}

/** 删除课程 */

export const removeLessonApi = (courseId: string | number) => {
  return http.delete<any>(`/edu/lessonMain/${courseId}`)
}
